$(document).ready(function () {
    $("#passBtn").click(function () {
        let currentConfirmed = $("#currentConfirmedCount").val();
        let suspected = $("#suspectedCount").val();
        let cured = $("#curedCount").val();
        let dead = $("#deadCount").val();
        let province = $("select").val();
        let date = $("#dateInput").val();
        if (date == '') {
            alert("日期不能为空！");
            return;
        }
        setValue(province, date, currentConfirmed, suspected, cured, dead);
    })
})

//设置数据
function setValue(province, date, currentConfirmed, suspected, cured, dead) {
    let url = "province?method=updatePro&province=" + province +
        "&currentConfirmed=" + currentConfirmed + "&suspected=" + suspected +
        "&cured=" + cured + "&dead=" + dead + "&date=" + date;
    $.get(url, function (data, status) {
        let errcode = data["errcode"];
        let errmsg = data["errmsg"];
        if (errcode)
            alert("[Error]" + errmsg);
        else
            alert("数据写入成功！");
    })
}